home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: sending AEevents from container to embedded parts
- Sent: 8/6/96 7:21 PM
- Received: 8/7/96 8:55 AM
- From: lamiraux@ix.netcom.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- > ODPart* embeddedPart = proxy->AcquireEmbeddedPart(ev);
-
- Something that has nothing to do with your problem but is still a
- problem in the code you sent: when calling method starting with
- "Acquire" you MUST release the returned object:
-
- ODPart* embeddedPart = proxy->AcquireEmbeddedPart(ev);
-
- <Some code here>
-
- embeddedPart->Release(ev);
-
-
- If you don't do that you will refcounting errors. The code above should
- be in fact be written
-
- FW_AcquiredODPart embeddedPart = proxy->AcquireEmbeddedPart(ev);
-
- <Some code here>
-
- This allows you to have the <Some code here> throwing an exception and
- still have embeddedPart being released correctly. This way you don't
- need a try block.
-
- Refcounting is very important in OpenDoc. Not paying attention to it
- will result in very poorly functionning part. ODF provides some tools
- (like the FW_CAcquiredODxxx classes) but cannot prevent developers from
- making mistakes.
-